package vn.cent.game.cardtype.client;


import vn.cent.game.cardtype.main.CardTypeGameExtension;
import vn.cent.game.cardtype.main.RoomController;
import vn.cent.game.cardtype.utils.GameKind;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;

public class RequestCreateNewRoom extends BaseClientRequestHandler {

	CardTypeGameExtension extension;
	GameKind gameKind;
	User sender;
	RoomController roomController;
	
	@Override
	public void handleClientRequest(User user, ISFSObject data) {
		String rName = data.getUtfString("RoomName");
		String rPassword = data.getUtfString("RoomPassword");
		byte tempGameKind = data.getByte("GameKind");
		sender = user;
		
		SetupVariables();
		
		switch (tempGameKind) {
		case 1:
			gameKind = GameKind.BC;
			break;
		case 2:
			gameKind = GameKind.CA;
			break;
		default:
			break;
		}
		
		CreateRoomBaseGameKind(rName, rPassword);
		
	}
	
	private void SetupVariables()
	{
		extension = (CardTypeGameExtension) getParentExtension();
		roomController = new RoomController(this.getApi(), extension, sender);
	}
	
	private void CreateRoomBaseGameKind(String rName, String rPassword)
	{
		//roomController.CreatePrivateBCRoom(rName, rPassword);
	}
}
